package com.tfjybj.itoo.exam.provider.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tfjybj.itoo.exam.entity.JudgeTaskEntity;
import com.tfjybj.itoo.exam.model.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * JudgeTaskDao接口
 * judgeTask表
 *
 * @author 任晓帅
 * @version 2.0.0
 * @since 2.0.0 2018-11-15 19:40:28
 */
@Repository("judgeTaskDao")
public interface JudgeTaskDao extends BaseMapper<JudgeTaskEntity> {
	
	//region 模板生成：模糊查询
	/**
     * 根据批卷班级名称模糊查询judgeTask
     *
     * @param teachclassName  批卷班级名称
     * @return 模糊查询的judgeTask集合
     * @author 任晓帅
     * @since 2.0.0 2018-11-15 19:40:28
     */
    List<JudgeTaskEntity> queryLikeTeachclassName(@Param("teachclassName") String teachclassName);
	//endregion

    /* **********************************以下为非模板生成的内容********************************* */
    /**
     * 根据实体内容进行查询
     * @param judgeTaskModelNorequired
     * @return
     * * @author 侯旭日
     * @since 2.0.0 2018-11-16 19:48:26
     */
    List<JudgeTaskModelResult>queryAllByModel(@Param("judgeTaskModelNorequired") JudgeTaskModelNorequired judgeTaskModelNorequired);

    /**
     * 绑定试卷名称下拉
     * @return
     * * @author 侯旭日
     * @since 2.0.0 2018-11-18 19:48:26
     */
    List<JudgeTaskModelResult>queryDistinctExam(String operaID);

    /**
     * 绑定大题号下拉
     * @return
     * * @author 侯旭日
     * @since 2.0.0 2018-11-18 19:48:26
     */
    List<JudgeTaskModelResult>queryDistinctBigQues(String operaID);

    /**
     * 绑定班级下拉
     * @return
     * * @author 侯旭日
     * @since 2.0.0 2018-11-18 19:48:26
     */
    List<JudgeTaskModelResult>queryDistinctClass(String operaID);


    /**
     * 根据考试Id、题型Id、班级Id查询所有答题记录
     * @param examId 考试Id
     * @param questionTypeId 题型Id
     * @param examClassId 班级Id
     * @author 侯旭日
     * @since 2.0.0 2018-11-23 19:48:2
     * @return
     */
    List<PaperRecordModel> queryJudgeQues(@Param("examId") String examId, @Param("questionTypeId") String questionTypeId, @Param("examClassId") String examClassId);

    List<PaperRecordModel> queryJudgeQuesBlend(@Param("examId") String examId, @Param("questionTypeId") String questionTypeId, @Param("examClassId") String examClassId);

    /**
     * 根据考试Id、题型Id、班级Id查询所有未判分总数
     * @param examId
     * @param questionTypeId
     * @param examClassId
     * @return
     * @author 侯旭日
     * @since 2.0.0 2018-11-15 19:48:26
     */
    Integer queryJudgeSituation(@Param("examId") String examId, @Param("questionTypeId") String questionTypeId, @Param("examClassId") String examClassId);

    Integer queryTotalSituation(@Param("examId") String examId, @Param("questionTypeId") String questionTypeId, @Param("examClassId") String examClassId);

    /**
     * 得到这场考试这个班级这类题型每个学生的总成绩
     * @param examId
     * @param questionTypeId
     * @param examClassId
     * @return
     * @author 侯旭日
     * @since 2.0.0 2018-11-15 19:48:26
     */
    List<PaperRecordModel> queryEachStuScore(@Param("examId") String examId, @Param("questionTypeId") String questionTypeId, @Param("examClassId") String examClassId);

    List<PaperRecordModel> queryEachStuScoreBlend(@Param("examId") String examId, @Param("questionTypeId") String questionTypeId, @Param("examClassId") String examClassId);

    /**
     *
     * @param examId
     * @param examClassId
     * @return
     */
    List<JudgeTotalScoreModel> queryEachPaperScore(@Param("examId") String examId, @Param("examClassId") String examClassId);

    /**
     *
     * @return
     */
    List<ExaminationModel> queryExamName(String operaID);
    List<JudgeTaskModelResult> queryQuestionTypeName(@Param("examinationId") String examinationId);





    /**
     * 根据JudgeTask批卷班级名称模糊查询
     * @param teachclassName
     * @param operator
     * @return
     * * @author 刘梦娇
     * @since 2.0.0 2018年12月7日21:32:50
     */
    List<JudgeTaskModelResult> queryLikeClassName(@Param("teachclassName") String teachclassName, @Param("operator") String operator);


    /**
     * 修改手动判分任务的批卷人
     * @param id
     * @param teacherId
     * @return 修改后的结果
     * @author 刘梦娇
     * @since 2.0.0 2018-12-14 15:01:12
     */
    boolean modifyJudgeTask(@Param("Id") String id, @Param("teacherId") String teacherId);

    /**
     * 查询是否存在JudgeTask
     *
     * @param examinationId 考试id
     * @param templateDetilsId 题型名称id
     * @param teachClassId 批卷班级id
     * @return 查询是否存在 JudgeTask
     * @author 杨海云
     * @since 2.0.0 2018-12-12 21:33:10
     */
    List<JudgeTaskModel> queryExistJudgeTask(@Param("examinationId") String examinationId, @Param("templateDetilsId") String templateDetilsId, @Param("teachClassId") String teachClassId);


    /**
     * 组合查询，根据考试id，题型id，批卷班级id，批卷教师id
     * @param operator 操作人
     * @param examinationId 考试id
     * @param templateDetailsId 题型id
     * @param teachclassId 批卷班级id
     * @param teacherId 批卷教师id
     * @return 符合条件的判分任务
     * @author 刘梦娇
     * @since 2018-12-18 19:45:21
     */
    List<JudgeTaskModelResult>queryCombine(@Param("operator") String operator, @Param("examinationId") String examinationId, @Param("templateDetailsId") String templateDetailsId, @Param("teachclassId") String teachclassId, @Param("teacherId") String teacherId);

    List<ModifyScoreModel>againJudgeByBusiness();

}




